home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / Macintosh Sample Code / SC.001.Sample / Sample.r < prev    next >
Encoding:
Text File  |  1989-05-31  |  6.1 KB  |  283 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple Sample Application
  6. #
  7. #    Sample
  8. #
  9. #    Sample.r    -    Rez Source
  10. #
  11. #    Copyright © 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89
  18. #                1.03                06/89
  19. #
  20. #    Components:
  21. #                Sample.p            June 1, 1989
  22. #                Sample.c            June 1, 1989
  23. #                Sample.a            June 1, 1989
  24. #                Sample.inc1.a        June 1, 1989
  25. #                SampleMisc.a        June 1, 1989
  26. #                Sample.r            June 1, 1989
  27. #                Sample.h            June 1, 1989
  28. #                PSample.make        June 1, 1989
  29. #                CSample.make        June 1, 1989
  30. #                ASample.make        June 1, 1989
  31. #
  32. #    Sample is an example application that demonstrates how to
  33. #    initialize the commonly used toolbox managers, operate 
  34. #    successfully under MultiFinder, handle desk accessories, 
  35. #    and create, grow, and zoom windows.
  36. #
  37. #    It does not by any means demonstrate all the techniques 
  38. #    you need for a large application. In particular, Sample 
  39. #    does not cover exception handling, multiple windows/documents, 
  40. #    sophisticated memory management, printing, or undo. All of 
  41. #    these are vital parts of a normal full-sized application.
  42. #
  43. #    This application is an example of the form of a Macintosh 
  44. #    application; it is NOT a template. It is NOT intended to be 
  45. #    used as a foundation for the next world-class, best-selling, 
  46. #    600K application. A stick figure drawing of the human body may 
  47. #    be a good example of the form for a painting, but that does not 
  48. #    mean it should be used as the basis for the next Mona Lisa.
  49. #
  50. #    We recommend that you review this program or TESample before 
  51. #    beginning a new application.
  52. ------------------------------------------------------------------------------*/
  53.  
  54.  
  55. #include "Types.r"
  56.  
  57. #include "Sample.h"
  58.  
  59.  
  60. /* this is a definition for a resource which contains only a rectangle */
  61.  
  62. type 'RECT' {
  63.     rect;
  64. };
  65.  
  66.  
  67. /* we use an MBAR resource to conveniently load all the menus */
  68.  
  69. resource 'MBAR' (rMenuBar, preload) {
  70.     { mApple, mFile, mEdit, mLight };    /* four menus */
  71. };
  72.  
  73.  
  74. resource 'MENU' (mApple, preload) {
  75.     mApple, textMenuProc,
  76.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  77.     enabled, apple,
  78.     {
  79.         "About Sample…",
  80.             noicon, nokey, nomark, plain;
  81.         "-",
  82.             noicon, nokey, nomark, plain
  83.     }
  84. };
  85.  
  86. resource 'MENU' (mFile, preload) {
  87.     mFile, textMenuProc,
  88.     MenuItem12,                /* enable Quit only, program enables others */
  89.     enabled, "File",
  90.     {
  91.         "New",
  92.             noicon, "N", nomark, plain;
  93.         "Open",
  94.             noicon, "O", nomark, plain;
  95.         "-",
  96.             noicon, nokey, nomark, plain;
  97.         "Close",
  98.             noicon, "W", nomark, plain;
  99.         "Save",
  100.             noicon, "S", nomark, plain;
  101.         "Save As…",
  102.             noicon, nokey, nomark, plain;
  103.         "Revert",
  104.             noicon, nokey, nomark, plain;
  105.         "-",
  106.             noicon, nokey, nomark, plain;
  107.         "Page Setup…",
  108.             noicon, nokey, nomark, plain;
  109.         "Print…",
  110.             noicon, nokey, nomark, plain;
  111.         "-",
  112.             noicon, nokey, nomark, plain;
  113.         "Quit",
  114.             noicon, "Q", nomark, plain
  115.     }
  116. };
  117.  
  118. resource 'MENU' (mEdit, preload) {
  119.     mEdit, textMenuProc,
  120.     NoItems,                /* disable everything, program does the enabling */
  121.     enabled, "Edit",
  122.      {
  123.         "Undo",
  124.             noicon, "Z", nomark, plain;
  125.         "-",
  126.             noicon, nokey, nomark, plain;
  127.         "Cut",
  128.             noicon, "X", nomark, plain;
  129.         "Copy",
  130.             noicon, "C", nomark, plain;
  131.         "Paste",
  132.             noicon, "V", nomark, plain;
  133.         "Clear",
  134.             noicon, nokey, nomark, plain
  135.     }
  136. };
  137.  
  138. resource 'MENU' (mLight, preload) {
  139.     mLight, textMenuProc,
  140.     NoItems,                /* disable everything, program does the enabling */
  141.     enabled, "Traffic",
  142.      {
  143.         "Red Light",
  144.             noicon, nokey, nomark, plain;
  145.         "Green Light",
  146.             noicon, nokey, nomark, plain
  147.     }
  148. };
  149.  
  150.  
  151. /* this ALRT and DITL are used as an About screen */
  152.  
  153. resource 'ALRT' (rAboutAlert, purgeable) {
  154.     {40, 20, 160, 290},
  155.     rAboutAlert,
  156.     { /* array: 4 elements */
  157.         /* [1] */
  158.         OK, visible, silent,
  159.         /* [2] */
  160.         OK, visible, silent,
  161.         /* [3] */
  162.         OK, visible, silent,
  163.         /* [4] */
  164.         OK, visible, silent
  165.     }
  166. };
  167.  
  168. resource 'DITL' (rAboutAlert, purgeable) {
  169.     { /* array DITLarray: 5 elements */
  170.         /* [1] */
  171.         {88, 180, 108, 260},
  172.         Button {
  173.             enabled,
  174.             "OK"
  175.         },
  176.         /* [2] */
  177.         {8, 8, 24, 214},
  178.         StaticText {
  179.             disabled,
  180.             "Simple Sample (Traffic Light)"
  181.         },
  182.         /* [3] */
  183.         {32, 8, 48, 237},
  184.         StaticText {
  185.             disabled,
  186.             "Copyright © 1989 Apple Computer"
  187.         },
  188.         /* [4] */
  189.         {56, 8, 72, 136},
  190.         StaticText {
  191.             disabled,
  192.             "Brought to you by:"
  193.         },
  194.         /* [5] */
  195.         {80, 24, 112, 167},
  196.         StaticText {
  197.             disabled,
  198.             "Macintosh Developer  Technical Support"
  199.         }
  200.     }
  201. };
  202.  
  203.  
  204. /* this ALRT and DITL are used as an error screen */
  205.  
  206. resource 'ALRT' (rUserAlert, purgeable) {
  207.     {40, 20, 120, 260},
  208.     rUserAlert,
  209.     { /* array: 4 elements */
  210.         /* [1] */
  211.         OK, visible, silent,
  212.         /* [2] */
  213.         OK, visible, silent,
  214.         /* [3] */
  215.         OK, visible, silent,
  216.         /* [4] */
  217.         OK, visible, silent
  218.     }
  219. };
  220.  
  221.  
  222. resource 'DITL' (rUserAlert, purgeable) {
  223.     { /* array DITLarray: 3 elements */
  224.         /* [1] */
  225.         {50, 150, 70, 230},
  226.         Button {
  227.             enabled,
  228.             "OK"
  229.         },
  230.         /* [2] */
  231.         {10, 60, 30, 230},
  232.         StaticText {
  233.             disabled,
  234.             "Sample - Error occurred!"
  235.         },
  236.         /* [3] */
  237.         {8, 8, 40, 40},
  238.         Icon {
  239.             disabled,
  240.             2
  241.         }
  242.     }
  243. };
  244.  
  245.  
  246. resource 'WIND' (rWindow, preload, purgeable) {
  247.     {60, 40, 290, 160},
  248.     noGrowDocProc, visible, noGoAway, 0x0, "Traffic"
  249. };
  250.  
  251. resource 'RECT' (rStopRect, preload, purgeable) {
  252.     {10, 10, 110, 110}
  253. };
  254.  
  255. resource 'RECT' (rGoRect, preload, purgeable) {
  256.     {120, 10, 220, 110}
  257. };
  258.  
  259.  
  260. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  261.  
  262. resource 'SIZE' (-1) {
  263.     dontSaveScreen,
  264.     acceptSuspendResumeEvents,
  265.     enableOptionSwitch,
  266.     canBackground,                /* we can background; we don't currently, but our sleep value */
  267.                                 /* guarantees we don't hog the Mac while we are in the background */
  268.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  269.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  270.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  271.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  272.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  273.     reserved,
  274.     reserved,
  275.     reserved,
  276.     reserved,
  277.     reserved,
  278.     reserved,
  279.     reserved,
  280.     kPrefSize * 1024,
  281.     kMinSize * 1024    
  282. };
  283.